package com.pactera.jep.service.sys.dto;

import com.pactera.jep.sys.model.Unit;
import org.apache.commons.collections.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

public class UnitDto extends Unit{
	
	private String id;
	
	private String title;
	
	private String parentId;

	List<UnitDto> children;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getTitle() {return title;}

	public void setTitle(String title) {this.title = title;}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public List<UnitDto> getChildren() {
		return children;
	}

	public void setChildren(List<UnitDto> children) {
		this.children = children;
	}
	
	public void addChildren(UnitDto unitDto) {
		if(CollectionUtils.isEmpty(children)) {
			this.children = new ArrayList<UnitDto>();
		}
		this.children.add(unitDto);
	}
}
